package huawei;
/**
* @Author: wanghongfucoder
* @Date:   2017-06-28 09:46:41
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-06-28 17:34:45
*/

import java.util.Scanner;
  
public class MaxHuiwen {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str = scanner.next();
            System.out.println(getResult(str));
        }
    }
  
    private static int getResult(String str) {
        int len = str.length();
        int maxLen = 0;
        // 奇数
        for (int i = 0; i < len; i++) {
            int j = i - 1, k = i + 1;
            while (j >= 0 && k < len && str.charAt(j) == str.charAt(k)) {
                int validlen = k - j + 1;
                if (validlen >maxLen) {
                    maxLen = validlen;
                }
                j--;
                k++;
            }
        }
        // 偶数
        for (int i = 0; i < len; i++) {
            int j = i, k = i + 1;
            while (j >= 0 && k < len && str.charAt(j) == str.charAt(k)) {
                int validlen = k - j + 1;
                if (validlen >maxLen) {
                    maxLen = validlen;
                }
                j--;
                k++;
            }
        }
        return maxLen;
    }
  
  // 最长公共字串
  public static void findMaxCommonStr(){  
        Scanner s =  new Scanner(System.in);  
        String str1 = s.next();  
        String str2 = s.next();  
          
        char a[] = str1.toCharArray();  
        char b[] = str2.toCharArray();  
          
        int maxlen = 0;       
        int startIndex=0;  
        int endIndex = 0;  
          
        for(int i=0;i<b.length;i++){//对于b数组中的每一个数组，从第一个开始分别与a中的值比较  
            int nowstartIndex = i;  
            int nowendIndex = i;  
            int tempb = i;///定义序列相同时，b下标当前值，如果直接使用i++，会造成下一个字符开始的遍历错误  
            int nowlen = 0;  
            boolean flag = false;  
            for(int j=0; j<a.length && tempb < b.length; j++){//临时值不能超过b长度  
                if(b[tempb] == a[j]){  
                    nowendIndex = tempb;  
                    nowlen = nowendIndex - nowstartIndex;  
                    tempb++;  
                    flag = true;  
                }else{  
                    if(flag == true){//如果之前的相同，再遇到一个不相同的字符，后面的不用再比较  
                        break;  
                    }//if  
                }//else  
            }//for  
            if(nowlen > maxlen){  
                maxlen = nowlen;  
                startIndex = nowstartIndex;  
                endIndex = nowendIndex;  
            }  
        }//for  
        for(int k=startIndex;k<=endIndex;k++){  
            System.out.print(b[k]);  
        }  
          
}
	//最长公共字串
	public static void commonstr(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String string1 = sc.next();
            String string2 = sc.next();
            String min = string1.length() > string2.length() ? string2 : string1;
            String max = string1.length() > string2.length() ? string1 : string2;
            int len = 0;
            String  res = null;
            for (int i=0; i<min.length(); i++){
                for (int j=i+len; j<min.length(); j++){
                    if (max.contains(min.substring(i,j+1))){
                        len = j-i+1;
                        res = min.substring(i, j+1);
                    }
                    else{
                        break;
                    }
                }
            }
        
            System.out.println(res);
        }
    }  
}

// 耗时较少的最大回文数
/**
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
       Scanner in = new Scanner(System.in);
       while (in.hasNextLine()) {
        String s = in.nextLine();
        System.out.println(manacher(s));   
       }
        
    }
     
    public static int manacher(String s) {
        int count =0;//记录最大回文
        StringBuffer sb = new StringBuffer();
        char[] c =s.toCharArray();
        sb.append("#");
        //对字符串进行封装
        for (int i = 0; i < c.length; i++) {
           sb.append(c[i]);
           sb.append("#");
        }
        int[] rad = new int[sb.length()];//记录新字符串以每个字符为中心的最大回文半径
        char[] cl = sb.toString().toCharArray();
        int max=0;//记录已经搜寻到的回文半径能到达右端的最达大值
        int id=0;//记录回文半径能到达最有端的回文字符串的中心
        for (int i = 1; i < cl.length; i++) {
           if (max>i) {
               rad[i]=Math.min(rad[2*id-i], max-i);
           }else {
               rad[i]=1;
           }
           while (i-rad[i]>=0 && i+rad[i]<cl.length && cl[(i-rad[i])]==cl[(i+rad[i])]) {
               rad[i]++;
           }
           if (i+rad[i]>max) {
               max=i+rad[i];
               id=i;
           }
           count=Math.max(count, rad[i]-1);
        }
         
         
        return count;
     }
     
}
*/